package p270jp.pxv.android.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import java.util.ArrayList;
import java.util.Objects;
import p014ae.AbstractActivityC0119m1;
import p014ae.C0135p4;
import p014ae.C0185y;
import p014ae.DialogInterface$OnClickListenerC0085g5;
import p047bg.C1124a;
import p064c6.Preconditions;
import p134ei.AnalyticsScreenName;
import p134ei.PixivAnalytics;
import p165fo.Subscribe;
import p187gl.PixivRequest;
import p189gn.AbstractC3435a;
import p210hh.PixivAccountManager;
import p216hn.DefaultConstructorMarker;
import p216hn.Lambda;
import p270jp.pxv.android.R;
import p270jp.pxv.android.event.LimitMuteEvent;
import p270jp.pxv.android.legacy.model.PixivTag;
import p270jp.pxv.android.legacy.model.PixivUser;
import p314lg.ActivityMuteSettingsBinding;
import p325m0.MutabilityOwnership;
import p347mm.MuteManager;
import p370ni.InfoType;
import p603wm.AbstractC6949c;
import p645yc.AndroidSchedulers;
import p671zc.CompositeDisposable;

/* compiled from: MuteSettingActivity.kt */
/* renamed from: jp.pxv.android.activity.MuteSettingActivity */
/* loaded from: classes2.dex */
public final class MuteSettingActivity extends AbstractActivityC0119m1 {

    /* renamed from: f0 */
    public static final C4015a f18398f0 = new C4015a(null);

    /* renamed from: c0 */
    public ActivityMuteSettingsBinding f18400c0;

    /* renamed from: b0 */
    public final CompositeDisposable f18399b0 = new CompositeDisposable();

    /* renamed from: d0 */
    public final AbstractC6949c f18401d0 = Preconditions.m9801Q(new C4016b(this, "CANDIDATE_USERS"));

    /* renamed from: e0 */
    public final AbstractC6949c f18402e0 = Preconditions.m9801Q(new C4017c(this, "CANDIDATE_TAGS"));

    /* compiled from: MuteSettingActivity.kt */
    /* renamed from: jp.pxv.android.activity.MuteSettingActivity$a */
    /* loaded from: classes2.dex */
    public static final class C4015a {
        public C4015a(DefaultConstructorMarker eVar) {
        }

        /* renamed from: a */
        public final Intent m4812a(Context context) {
            MutabilityOwnership.m3745m(context, "context");
            return m4811b(context, new ArrayList<>(), new ArrayList<>());
        }

        /* renamed from: b */
        public final Intent m4811b(Context context, ArrayList<PixivUser> arrayList, ArrayList<PixivTag> arrayList2) {
            MutabilityOwnership.m3745m(context, "context");
            MutabilityOwnership.m3745m(arrayList, "muteCandidateUsers");
            MutabilityOwnership.m3745m(arrayList2, "muteCandidateTags");
            Intent intent = new Intent(context, MuteSettingActivity.class);
            intent.putExtra("CANDIDATE_USERS", arrayList);
            intent.putExtra("CANDIDATE_TAGS", arrayList2);
            return intent;
        }
    }

    /* compiled from: ActivityExtension.kt */
    /* renamed from: jp.pxv.android.activity.MuteSettingActivity$b */
    /* loaded from: classes2.dex */
    public static final class C4016b extends Lambda implements AbstractC3435a<ArrayList<PixivUser>> {

        /* renamed from: a */
        public final /* synthetic */ Activity f18403a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4016b(Activity activity, String str) {
            super(0);
            this.f18403a = activity;
        }

        @Override // p189gn.AbstractC3435a
        public final ArrayList<PixivUser> invoke() {
            Bundle extras = this.f18403a.getIntent().getExtras();
            if (extras != null) {
                Object obj = extras.get("CANDIDATE_USERS");
                Objects.requireNonNull(obj, "null cannot be cast to non-null type java.util.ArrayList<jp.pxv.android.legacy.model.PixivUser>");
                return (ArrayList) obj;
            }
            throw new IllegalArgumentException("Required value was null.".toString());
        }
    }

    /* compiled from: ActivityExtension.kt */
    /* renamed from: jp.pxv.android.activity.MuteSettingActivity$c */
    /* loaded from: classes2.dex */
    public static final class C4017c extends Lambda implements AbstractC3435a<ArrayList<PixivTag>> {

        /* renamed from: a */
        public final /* synthetic */ Activity f18404a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4017c(Activity activity, String str) {
            super(0);
            this.f18404a = activity;
        }

        @Override // p189gn.AbstractC3435a
        public final ArrayList<PixivTag> invoke() {
            Bundle extras = this.f18404a.getIntent().getExtras();
            if (extras != null) {
                Object obj = extras.get("CANDIDATE_TAGS");
                Objects.requireNonNull(obj, "null cannot be cast to non-null type java.util.ArrayList<jp.pxv.android.legacy.model.PixivTag>");
                return (ArrayList) obj;
            }
            throw new IllegalArgumentException("Required value was null.".toString());
        }
    }

    /* renamed from: e1 */
    public final void m4813e1() {
        ActivityMuteSettingsBinding wVar = this.f18400c0;
        if (wVar != null) {
            wVar.f22372s.m4595d(InfoType.LOADING, null);
            this.f18399b0.mo82c(PixivRequest.m5814c().m966j(AndroidSchedulers.m334a()).m963m(new C0185y(this, 2), new C0135p4(this, 1)));
            return;
        }
        MutabilityOwnership.m3737u("binding");
        throw null;
    }

    @Override // p270jp.pxv.android.activity.AbstractActivityC4151b, androidx.activity.ComponentActivity, android.app.Activity
    public void onBackPressed() {
        MuteManager.f23061h.m3542a();
        super.onBackPressed();
    }

    @Override // p270jp.pxv.android.activity.AbstractActivityC4151b, p270jp.pxv.android.activity.BaseActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        ViewDataBinding d = DataBindingUtil.m11369d(this, R.layout.activity_mute_settings);
        MutabilityOwnership.m3746l(d, "setContentView(this, R.l…t.activity_mute_settings)");
        ActivityMuteSettingsBinding wVar = (ActivityMuteSettingsBinding) d;
        this.f18400c0 = wVar;
        C1124a.m10197Q(this, wVar.f22373t, R.string.mute_settings);
        PixivAnalytics eVar = this.f18757A;
        MutabilityOwnership.m3746l(eVar, "pixivAnalytics");
        eVar.m6524f(AnalyticsScreenName.MUTE_SETTING, null);
        m4813e1();
    }

    @Override // p014ae.AdActivity, p270jp.pxv.android.activity.BaseActivity, p116e.ActivityC2727f, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onDestroy() {
        super.onDestroy();
        this.f18399b0.m80f();
    }

    @Subscribe
    public final void onEvent(LimitMuteEvent limitMuteEvent) {
        MutabilityOwnership.m3745m(limitMuteEvent, "event");
        if (PixivAccountManager.m5511e().f16503i) {
            AlertDialog.C0305a aVar = new AlertDialog.C0305a(this);
            aVar.f1085a.f1054d = getString(R.string.mute_settings);
            aVar.f1085a.f1056f = getString(R.string.mute_limit_dialog_message, new Object[]{Integer.valueOf(MuteManager.f23061h.f23062a)});
            aVar.m12010d(getString(R.string.confirm_learning_dialog_ok), null);
            aVar.m12005i();
            return;
        }
        AlertDialog.C0305a aVar2 = new AlertDialog.C0305a(this);
        aVar2.f1085a.f1056f = getString(R.string.mute_premium_dialog_message, new Object[]{Integer.valueOf(MuteManager.f23061h.f23062a + 1)});
        aVar2.m12007g(getString(R.string.premium_register), new DialogInterface$OnClickListenerC0085g5(this, 0));
        aVar2.m12010d(getString(R.string.common_cancel), null);
        aVar2.m12005i();
    }
}
